import http from '@/utils/http'

//获取一级分类
export const getOneListApi = async () => {
    const url = '/api/catelist'
    return http.get(url,{params:{istree:true}})
}
//获取二级分类
export const getTwoListApi = async (data) => {
    const url = '/api/catelist'
    return http.get(url,data)
}

//获取商品的规格列表
export const getSpecsApi = async () => {
    const url = '/api/specslist'
    return http.get(url)
}
//获取商品的属性列表
export const getAttrApi = async (data) => {
    const url = '/api/specsinfo'
    return http.get(url,data)
}

//获取二级分类的商品
export const getTwoApi = async (data) => {
    const url = '/api/goodslist'
    return http.get(url,data)
}

export const getGoodsApi = async (data) => {
    const url = '/api/goodslist'
    return http.get(url,data)
}

export const getTotalPageApi = async () => {
    const url = '/api/goodscount'
    return http.get(url)
}

export const addSeckillApi = async (data) => {
    const url = '/api/seckadd'
    return http.post(url, data)
}

export const delSeckillApi = async (data) => {
    const url = '/api/goodsdelete'
    return http.post(url, { id : data })
}

export const getOneApi = async (data) => {
    const url = '/api/goodsinfo'
    return http.get(url, data)
}

export const getSeckillListApi = async () => {
    const url = '/api/secklist'
    return http.get(url)
}